package com.iptv.webtest.controller;

import com.iptv.webtest.entity.PostJsonEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author willSir
 * @date 2021/10/14_10:56
 */
@Controller
public class AppDataController {

    @RequestMapping("/getData")
    @ResponseBody
    public List<Map<String, Object>> getData(){
        System.out.println("请求获取数据");

        List<Map<String, Object>> mapList = new ArrayList<>();
        for (int j = 0; j < 6; j++) {
            Map<String, Object> map = new HashMap<>();
            List<PostJsonEntity> entityList_01 = new ArrayList<>();
            for (int i = 0; i < 12; i++) {
                PostJsonEntity postJsonEntity_01 = new PostJsonEntity();
                postJsonEntity_01.setName("分类"+j+"内容名称"+i);
                postJsonEntity_01.setImg("imgs/cover.png");
                entityList_01.add(postJsonEntity_01);
            }
            map.put("name","类型名称"+j);
            map.put("content",entityList_01);
            mapList.add(map);
        }
        return mapList;
    }
}
